
option explicit

' ------------------------------------------------------------------------------
' ------------------------------------------------------------------------------
' --- Quebla - Filter Handle Library - Version 1.0.0
' --- Autor:    Sardi, Leandro Daniel
' --- Mail:     lsardi@quebla.com.ar
' --- Fecha:    2006/06/05
' ---
' --- Copyright Quebla (c). Todos los derechos reservados
' ---

class CFilterHnd

    ' --------------------------------------------------------------------------
    ' Parte Privada
    private m_oColumnHnd1
    private m_oColumnHnd2
    private m_sOperator
    private m_sBeginBlock
    private m_sEndBlock
    private m_sBeginOperator
    private m_sEndOperator


    ' --------------------------------------------------------------------------
    ' --- Parte Privada : Eventos
    private sub Class_Initialize()
        set m_oColumnHnd1 = nothing
        set m_oColumnHnd2 = nothing

        m_sOperator = VH_OPERATOR_EQUAL
        m_sBeginBlock = VH_BLOCK_NULL
        m_sEndBlock = VH_BLOCK_NULL
        m_sBeginOperator = VH_OPERATOR_AND
        m_sEndOperator = VH_OPERATOR_NULL
    end sub


    private sub Class_Terminate()
        ' Falta
        ' Falta
        ' Falta
        ' Falta
        ' Falta
    end sub



    ' --------------------------------------------------------------------------
    ' Parte Publica
    public property get oColumnHnd1()
        set oColumnHnd1 = m_oColumnHnd1
    end property

    public property set oColumnHnd1(byval o)
        set m_oColumnHnd1 = o
    end property


    public property get oColumnHnd2()
        set oColumnHnd2 = m_oColumnHnd2
    end property

    public property set oColumnHnd2(byval o)
        set m_oColumnHnd2 = o
    end property


    public property get sOperator()
        sOperator = m_sOperator
    end property

    public property let sOperator(byval s)
        m_sOperator = s
    end property


    public property get sBeginBlock()
        sBeginBlock = m_sBeginBlock
    end property

    public property let sBeginBlock(byval s)
        m_sBeginBlock = s
    end property


    public property get sEndBlock()
        sEndBlock = m_sEndBlock
    end property

    public property let sEndBlock(byval s)
        m_sEndBlock = s
    end property


    public property get sBeginOperator()
        sBeginOperator = m_sBeginOperator
    end property

    public property let sBeginOperator(byval s)
        m_sBeginOperator = s
    end property


    public property get sEndOperator()
        sEndOperator = m_sEndOperator
    end property

    public property let sEndOperator(byval s)
        m_sEndOperator = s
    end property


    ' Expresion que corresponde a WHERE ...
    public function GetExpresion()
        dim sRes    ' Variable de retorno

        ' Si tengo los dos Column Handler
        if not m_oColumnHnd1 is nothing and not m_oColumnHnd2 is nothing then

            sRes = m_sBeginBlock & " " & _
                   m_oColumnHnd1.sExpresionForFilter() & " " & _
                   m_sOperator & " " & _
                   m_oColumnHnd2.sExpresionForFilter() & " " & _
                   m_sEndBlock
                   
        else
            ' ERROR
            Err.Raise Q_COLUMNHND_WITHOUT_VIEW, Q_COLUMNHND_WITHOUT_VIEW_DESC
        end if

        ' Retorno
        GetExpresion = sRes
    end function


end class


